package demo.springboot;

import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import demo.hello.User;

@RestController
public class HelloController {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    
    @RequestMapping("/send")
	public String send(){
        System.out.println("rocketMQTemplate:"+rocketMQTemplate);
//        rocketMQTemplate.sendMessageInTransaction(destination, message, arg);
        rocketMQTemplate.convertAndSend("TopicTest1", "Hello world10");
        return "ok";
	}
    @RequestMapping("/send2")
	public String send2(){
    	User user = new User();
        user.setName("jack");
        user.setSex("1");
        rocketMQTemplate.syncSend("TopicTest5", user);
        return "ok";
	}
}
